import com.sap.smb.sbo.api.*;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: mlv
 * Date: 2013-2-20
 * Time: 17:11:21
 * To change this template use File | Settings | File Templates.
 */
public class DocumentAdd {

    public static void add() throws SBOCOMException {
          JcoConn conn = new JcoConn();

     int rc = conn.conn();
        System.out.println(rc);
        IDocuments invoice =

        SBOCOMUtil.newDocuments(conn.getCompany(), SBOCOMConstants.BoObjectTypes_Document_oInvoices);


        invoice.setCardCode("D00001");

        invoice.setDocDate(new Date());

        invoice.setDocDueDate(new Date());



        invoice.getLines().add();

        invoice.getLines().setItemCode("0101009");

        invoice.getLines().setQuantity(new Double(2.0));

        invoice.getLines().setPrice(new Double(2.0));



        int result = invoice.add();

        System.out.println(result);
    }

    public static void find() throws SBOCOMException {
        JcoConn conn = new JcoConn();

            int rc = conn.conn();
               System.out.println(rc);

            IBusinessPartners partners = SBOCOMUtil.getBusinessPartners(conn.getCompany(),"C70000") ;

        System.out.println(partners.getAliasName());
        System.out.println(partners.getCardName());

    }
    public static void main(String[] args) throws SBOCOMException {
          find();
    }
}
